import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);
const userData = localStorage.getItem("userData") ?
    JSON.parse(localStorage.getItem("userData")) :
    [];
export default new Vuex.Store({
    state: {
    	userData,
    },
    mutations: {
    	addUser(state,newChild) {
    		state.userData.push(newChild);
    		localStorage.setItem("userData",JSON.stringify(state.userData));
    	}
    },
    actions: {}
});